package com.fr.report.js;

import com.fr.base.FCloneable;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLReadable;
import com.fr.base.xml.XMLableReader;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class NameJavaScriptGroup
  implements XMLReadable, Serializable, FCloneable
{
  private static final long serialVersionUID = -3720916110080326383L;
  public static final String OLD_XML_TAG = "NameHyperlinkGroup";
  public static final String XML_TAG = "NameJavaScriptGroup";
  private List links;

  public NameJavaScriptGroup()
  {
    this.links = new ArrayList();
  }

  public NameJavaScriptGroup(JavaScript paramJavaScript)
  {
    this(new NameJavaScript("Default", paramJavaScript));
  }

  public NameJavaScriptGroup(NameJavaScript paramNameJavaScript)
  {
    this(new NameJavaScript[] { paramNameJavaScript });
  }

  public NameJavaScriptGroup(NameJavaScript[] paramArrayOfNameJavaScript)
  {
    this.links = new ArrayList();
    this.links.addAll(Arrays.asList(paramArrayOfNameJavaScript));
  }

  public int size()
  {
    return this.links.size();
  }

  public NameJavaScript getNameHyperlink(int paramInt)
  {
    return ((NameJavaScript)this.links.get(paramInt));
  }

  public void addNameHyperlink(NameJavaScript paramNameJavaScript)
  {
    this.links.add(paramNameJavaScript);
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isAttr())
      this.links.clear();
    if (paramXMLableReader.isChildNode())
    {
      String str = paramXMLableReader.getTagName();
      if (("NameHyperlink".equals(str)) || ("NameJavaScript".equals(str)))
      {
        NameJavaScript localNameJavaScript = new NameJavaScript();
        paramXMLableReader.readXMLObject(localNameJavaScript);
        this.links.add(localNameJavaScript);
      }
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    if (size() == 0)
      return;
    paramXMLPrintWriter.startTAG("NameJavaScriptGroup");
    for (int i = 0; i < size(); ++i)
      getNameHyperlink(i).writeXML(paramXMLPrintWriter);
    paramXMLPrintWriter.end();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    NameJavaScriptGroup localNameJavaScriptGroup = (NameJavaScriptGroup)super.clone();
    if (this.links != null)
    {
      localNameJavaScriptGroup.links = new ArrayList(size());
      int i = 0;
      int j = size();
      while (i < j)
      {
        localNameJavaScriptGroup.links.add((NameJavaScript)getNameHyperlink(i).clone());
        ++i;
      }
    }
    return localNameJavaScriptGroup;
  }

  public boolean equals(Object paramObject)
  {
    if (!(paramObject instanceof NameJavaScriptGroup))
      return false;
    NameJavaScriptGroup localNameJavaScriptGroup = (NameJavaScriptGroup)paramObject;
    if (localNameJavaScriptGroup.size() != size())
      return false;
    for (int i = 0; i < localNameJavaScriptGroup.size(); ++i)
      if (!(localNameJavaScriptGroup.getNameHyperlink(i).equals(getNameHyperlink(i))))
        return false;
    return true;
  }
}